package com.sql;

public class MysqlSql {
	/**
	 * 根据所有者取得该所有者下的表
	 * table_schema (所有者)
	 * TABLE_NAME (表名)
	 * TABLE_TYPE (表类型<表、视图、等>)
	 * COMMENTS (注释)
	 */
	public final static String get_tab_comments="select TABLE_NAME,table_comment COMMENTS,TABLE_TYPE from information_schema.tables where table_schema =? order by table_name ";
	
	/**
	 * 查询所有表的字段信息
	 * COMMENTS(注释)
	 * TABLE_NAME(表名)
	 * COLUMN_NAME(字段名)
	 * DATA_TYPE(字段类型)
	 * DATA_TYPE_MOD(列的数据类型修饰符)
	 * DATA_TYPE_OWNER(列的数据类型的所有者)
	 * DATA_LENGTH(数据长度*2)
	 * DATA_PRECISION(数值长度)
	 * DATA_SCALE(小数点位数)
	 * NULLABLE(是否允许为空)
	 * COLUMN_ID(列ID)
	 * DEFAULT_LENGTH(默认值长度)
	 * DATA_DEFAULT(默认值)
	 * PrimaryKey(主键)
	 */
	public final static StringBuffer get_tab_col=new StringBuffer("select  TABLE_NAME,COLUMN_NAME,\r\n" + 
			"	ordinal_position COLUMN_ID,column_default DATA_DEFAULT,IS_NULLABLE NULLABLE, DATA_TYPE,\r\n" + 
			"	CHARACTER_MAXIMUM_LENGTH DATA_LENGTH,NUMERIC_PRECISION DATA_PRECISION,\r\n" + 
			"	NUMERIC_SCALE DATA_SCALE,COLUMN_KEY PrimaryKey,COLUMN_COMMENT COMMENTS  from information_schema.columns where TABLE_NAME=? and table_schema =? ;");
}
